//
//  Utilities.h
//  ExhibitionHall
//
//  Created by 王洋 on 2019/6/11.
//  Copyright © 2019 王洋. All rights reserved.
//

#import <Foundation/Foundation.h>
@import AudioToolbox;

NS_ASSUME_NONNULL_BEGIN

@interface Utilities : NSObject


#pragma mark  View 操作 ------------------------------
//根据颜色生成图片
+ (UIImage *)createImageWithColor:(UIColor *)color width:(CGFloat)width height:(CGFloat)height;

#pragma mark  NSTimeInterval 操作 ------------------------------
//获取当前时间戳
+ (NSTimeInterval )getCurrentTimestamp;
//获取服务器当前时间戳
+ (NSTimeInterval)getCurrentServerTimestamp;

+ (NSTimeInterval )getTimestampWithDate:(NSDate *)date;

+ (NSString *)getTimeFromTimestamp:(NSTimeInterval)time;

+ (NSString *)getTodayAfterDateWithCount:(NSInteger)count;
//检查是否有小数位
//+ (BOOL)isDoubleValueContainDecimal:(double)doubleValue;
//检查活动处于哪个阶段
+ (PPActivityProgress)checkActivityProgressWithStart:(NSTimeInterval)startStamp AndEnd:(NSTimeInterval)endStamp;

#pragma mark  NSString 操作 ------------------------------

+ (NSDictionary *)dictionaryWithJsonString:(id)jsonD;

+ (NSDictionary *)dictionaryWithString:(NSString *)jsonString;

+ (NSString *)stringWithDictionary:(NSDictionary *)dict;

+ (NSString *)changeDoubleToString:(double)doubleValue;

+ (NSString *) utf8ToUnicode:(NSString *)string;

+ (NSMutableDictionary *)getParams:(NSString *)str;

//检查手机号
+ (BOOL)checkPhoneTel:(NSString *)phoneStr;

+ (BOOL)checkOnceADayWithKey:(NSString *)key;

+ (float)getStringWidthWithString:(NSString *)value fontSize:(float)fontSize andHeight:(float)height;

#pragma mark  加密 ------------------------------
// DES加密
+ (NSString *)encodeDesWithString:(NSString *)str;
// DES解密
+ (NSString *)decodeDesWithString:(NSString *)str;
// MD5加密
+ (NSString *)md5:(NSString *)string;

+ (NSString *)NeteaseMd5:(NSString *)string;

#pragma mark  防抓包 ------------------------------
+ (BOOL)getProxyStatus;

#pragma mark  硬件Api ------------------------------
//线性马达工作（震动）
+ (void)tapticEngineWork;

+ (void)playSoundWithFileName:(NSString *)name fileType:(NSString *)type;

+ (void)callPhone:(NSString*)phoneNum;

@end

NS_ASSUME_NONNULL_END
